﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WR.BL.BE;
using WR.DL.DALC.SAP;

namespace WR.BL.BCC
{
    public class SalesOrderBC
    {
        private string _connId = string.Empty;

        #region Singleton
        public static SalesOrderBC getInstance(string pConnId)
        {
            if (_instance == null)
            {
                lock (typeof(SalesOrderBC))
                {
                    if (_instance == null)
                    {
                        _instance = new SalesOrderBC(pConnId);
                    }
                }
            }
            return _instance;
        }
        private SalesOrderBC(string pConnId) { this._connId = pConnId; }
        private static volatile SalesOrderBC _instance = null;
        #endregion

        public List<SalesOrderBE> find(string pTienda, string pClaseDoc, string pNdoc, string pFechaI, string pFecheF)
        {
            return SalesOrderDALC.getInstance(this._connId).find(pTienda, pClaseDoc, pNdoc, pFechaI, pFecheF);
        }

        public string save(SalesOrderBE pSO, out string oNumDoc, string valida)
        {
            return SalesOrderDALC.getInstance(this._connId).save(pSO, out oNumDoc, valida);
        }

        public string read(string strCotId, out SalesOrderBE oSalesOrder)
        {
            return SalesOrderDALC.getInstance(this._connId).read(strCotId, out oSalesOrder);
        }

        public string sendCorreo(string pCorreo, string pNroDoc, string pTipDoc, string pClasDoc)
        {
            return SalesOrderDALC.getInstance(this._connId).sendCorreo(pCorreo, pNroDoc, pTipDoc, pClasDoc);
        }

        public string update(SalesOrderBE pSO, out bool oModificado, string valida)
        {
            return SalesOrderDALC.getInstance(this._connId).update(pSO, out oModificado, valida);
        }

        public List<GenericBE> getClaseDoc(string pCod, string pDesc)
        {
            return SalesOrderDALC.getInstance(this._connId).getClaseDoc(pCod, pDesc);
        }

        public List<GenericBE> getRegiones()
        {
            return SalesOrderDALC.getInstance(this._connId).getRegiones();
        }

        public DocImprBE find(string pNdoc)
        {
            return SalesOrderDALC.getInstance(this._connId).find(pNdoc);
        }
    }
}
